package com.longge;

public class CountGoodStrings {

    public int countGoodStrings(int low, int high, int zero, int one) {

        int[] dp = new int[high + 1];
        for (int i = 1; i <= high; i++) {
            if (i - zero >= 0) {
                dp[i] = (dp[i] + (dp[i - zero] == 0 && i - zero == 0 ? 1 : dp[i - zero])) % 1000000007;
            }
            if (i - one >= 0) {
                dp[i] = (dp[i] +( dp[i - one] == 0 && i - one == 0 ? 1 : dp[i - one])) % 1000000007;
            }
        }
        int ans = 0;
        for (int i = low; i <= high; i++) {
            ans += dp[i];
        }
        return ans;
    }

    public static void main(String[] args) {
        new CountGoodStrings().countGoodStrings(5, 5, 2, 4);
    }
}
